﻿using System;

namespace Program2
{
    class Program2
    {
        static void Main(string[] args)
        {
          
                Console.Write("请输入下限：");
                int lower;
                int.TryParse(Console.ReadLine(), out lower);
                Console.Write("请输入上限：");
                int upper;
                int.TryParse(Console.ReadLine(), out upper);
               
                int count = 0;
                for (int num = Math.Max(lower, 2); num <= upper; num++)
                {
                    if (IsPrime(num))
                    {
                        Console.Write($"{num,8}"); 
                        if (++count % 10 == 0) Console.WriteLine(); 
                    }
                }
              
            }
            
        static bool IsPrime(int number)
        {
            if (number <= 1) return false;
            if (number == 2) return true;
            if (number % 2 == 0) return false;

            int boundary = (int)Math.Sqrt(number);
            for (int i = 3; i <= boundary; i += 2)
            {
                if (number % i == 0) return false;
            }
            return true;
        }
    }
}